"use strict";
//https://api.weixin.qq.com/sns/jscode2session
Object.defineProperty(exports, "__esModule", { value: true });
const weixin_request_1 = require("./weixin-request");
class SNS {
    constructor(configReader) {
        this.cr = configReader;
    }
    url(path) {
        return `https://api.weixin.qq.com/sns/${path}`;
    }
    async jscode2session(code) {
        let url = this.url("jscode2session");
        let r = await weixin_request_1.WeiXinRequest.get(url, {
            appid: this.cr.getMiniAppId(), secret: this.cr.getMiniAppKey(),
            js_code: code, grant_type: "authorization_code"
        });
        return r;
    }
}
exports.SNS = SNS;
